package com.michael.demo.springcloud.alibaba.consumer.service;

import com.michael.demo.springcloud.alibaba.consumer.service.fallback.EchoServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 类功能描述:
 * <pre>
 *   FeignClient Demo
 * </pre>
 *
 * @author Michael
 * @version 1.0
 * @date 2021/03/31 14:34
 */
@FeignClient(
        name = "service-provider",
        fallbackFactory = EchoServiceFallbackFactory.class
)
public interface EchoService {

    @GetMapping("/echo/{str}")
    String echo(@PathVariable("str") String str);


    @GetMapping("/divide")
    default String divide(@RequestParam("a") Integer a, @RequestParam("b") Integer b) {
        return "" + a / b;
    }

    @GetMapping("/notFound")
    String notFound();
}
